rem build solitair

if not %POCKETBOOKSDK%.==. goto C1
echo Environment variable POCKETBOOKSDK is not set
pause
:C1
set PATH=%POCKETBOOKSDK%\bin;%PATH%

set INCLUDE=..\include
set LIBS=-linkview -lfreetype -ljpeg -lz -lgdi32
set OUTPUTDIR=dist\\solitaire
set OUTPUT=%OUTPUTDIR%\\solitaire.exe
set IMAGES=..\resources

rm -f %OUTPUT%
rm -f %OURPUTDIR%\*.*

pbres -c resources.c %IMAGES%\*.bmp
if errorlevel 1 goto L_ER

gcc -static -Wall -fomit-frame-pointer -I%INCLUDE% -g -c -o %OUTPUTDIR%\resources.o resources.c 
if errorlevel 1 goto L_ER
g++ -static -Wall -fomit-frame-pointer -I%INCLUDE% -g -c -o %OUTPUTDIR%\Table.o solitaire\Table.cpp 
if errorlevel 1 goto L_ER
g++ -static -Wall -fomit-frame-pointer -I%INCLUDE% -g -c -o %OUTPUTDIR%\Card.o solitaire\Card.cpp 
if errorlevel 1 goto L_ER
g++ -static -Wall -fomit-frame-pointer -I%INCLUDE% -g -c -o %OUTPUTDIR%\iface.o iface.cpp
if errorlevel 1 goto L_ER
g++ -static -Wall -fomit-frame-pointer -I%INCLUDE% -g -c -o %OUTPUTDIR%\solitaire.o solitaire\solitaire.cpp 
if errorlevel 1 goto L_ER
g++ -static -Wall -fomit-frame-pointer -I%INCLUDE% -g -c -o %OUTPUTDIR%\Block.o solitaire\Block.cpp 
if errorlevel 1 goto L_ER
g++ -static -Wall -fomit-frame-pointer -I%INCLUDE% -g -c -o %OUTPUTDIR%\Hand.o solitaire\Hand.cpp 
if errorlevel 1 goto L_ER
g++ -static -Wall -fomit-frame-pointer -I%INCLUDE% -g -c -o %OUTPUTDIR%\Tableau.o solitaire\Tableau.cpp 
if errorlevel 1 goto L_ER
g++ -static -Wall -fomit-frame-pointer -I%INCLUDE% -g -c -o %OUTPUTDIR%\Buffer.o solitaire\Buffer.cpp 
if errorlevel 1 goto L_ER
g++ -static -Wall -fomit-frame-pointer -I%INCLUDE% -g -c -o %OUTPUTDIR%\Foundation.o solitaire\Foundation.cpp 
if errorlevel 1 goto L_ER
g++ -static -Wall -fomit-frame-pointer -I%INCLUDE% -g -c -o %OUTPUTDIR%\Slot.o solitaire\Slot.cpp 
if errorlevel 1 goto L_ER
g++ -static -Wall -fomit-frame-pointer -I%INCLUDE% -g -c -o %OUTPUTDIR%\Wastepile.o solitaire\Wastepile.cpp 
if errorlevel 1 goto L_ER

g++ -static -Wall -fomit-frame-pointer -o %OUTPUT% %OUTPUTDIR%\\Block.o %OUTPUTDIR%\\solitaire.o %OUTPUTDIR%\\Slot.o %OUTPUTDIR%\\Buffer.o %OUTPUTDIR%\\Card.o %OUTPUTDIR%\\Foundation.o %OUTPUTDIR%\\Table.o %OUTPUTDIR%\\Tableau.o %OUTPUTDIR%\\Wastepile.o %OUTPUTDIR%\\Hand.o %OUTPUTDIR%\\iface.o %OUTPUTDIR%\\resources.o %LIBS%
if errorlevel 1 goto L_ER

echo normal exit
rem exit 0

:L_ER
echo error detected!
rem exit 1
